package cn.iocoder.yudao.module.gateway.dal.mysql.deviceconfig;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.gateway.dal.dataobject.deviceconfig.DeviceConfigDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.gateway.controller.admin.deviceconfig.vo.*;

/**
 * 设备配置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface DeviceConfigMapper extends BaseMapperX<DeviceConfigDO> {

    default PageResult<DeviceConfigDO> selectPage(DeviceConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceConfigDO>()
                .eqIfPresent(DeviceConfigDO::getClientClientId, reqVO.getClientClientId())
                .eqIfPresent(DeviceConfigDO::getClientDeviceIndex, reqVO.getClientDeviceIndex())
                .likeIfPresent(DeviceConfigDO::getClientDeviceName, reqVO.getClientDeviceName())
                .eqIfPresent(DeviceConfigDO::getClientDeviceType, reqVO.getClientDeviceType())
                .eqIfPresent(DeviceConfigDO::getClientDeviceRoomNumber, reqVO.getClientDeviceRoomNumber())
                .eqIfPresent(DeviceConfigDO::getPlatformClientId, reqVO.getPlatformClientId())
                .eqIfPresent(DeviceConfigDO::getPlatformProductId, reqVO.getPlatformProductId())
                .eqIfPresent(DeviceConfigDO::getPlatformDeviceSerialNumber, reqVO.getPlatformDeviceSerialNumber())
                .eqIfPresent(DeviceConfigDO::getPlatformUserId, reqVO.getPlatformUserId())
                .likeIfPresent(DeviceConfigDO::getPlatformProductName, reqVO.getPlatformProductName())
                .likeIfPresent(DeviceConfigDO::getPlatformDeviceName, reqVO.getPlatformDeviceName())
                .eqIfPresent(DeviceConfigDO::getPlatformDeviceType, reqVO.getPlatformDeviceType())
                .orderByDesc(DeviceConfigDO::getId));
    }

}